import loadingurl from '@/assets/loading.svg';
import styles from './loading.module.less';
export default function(el,binding){
    const curimg=gettarget(el);
    if(binding.value){
        if(curimg)
        return;
        else{
            const img=document.createElement("img");
            img.dataset.target='loding';
            img.src=loadingurl;
            img.className=styles.loading;
            el.appendChild(img);
        }
    }
    else{
        if(curimg){
            curimg.remove();
        }
    }
}
function gettarget(el){
    return el.querySelector('img[data-target=loding]');
}